#pragma once
#include <afxwin.h>
#include "UIControl.h"

#define RED        RGB(127, 0, 0)
#define GREEN      RGB(0, 127, 0)
#define BLUE       RGB(0, 0, 127)
#define LIGHTRED   RGB(255, 0, 0)
#define LIGHTGREEN RGB(0, 255, 0)
#define LIGHTBLUE  RGB(0, 0, 255)
#define BLACK_DEFAULT RGB(240, 240, 240)
#define BLACK      RGB(0, 0, 0)
#define WHITE      RGB(255, 255, 255)
#define GRAY       RGB(192, 192, 192)
#define MAX_CELL   1000


// CColorStatic

class UICONTROL_API CColorStatic : public CStatic
{
	DECLARE_DYNAMIC(CColorStatic)

public:
	CColorStatic();
	virtual ~CColorStatic();

	void SetTextColor(COLORREF crColor); // This Function is to set the Color for the Text.
	void SetBkColor(COLORREF crColor); // This Function is to set the BackGround Color for the Text.
	void SetTextFont(int nPoint, LPCTSTR lpszFaceName, BOOL bBold = FALSE, BOOL bItalic = FALSE);
	BOOL SetWindowText(CString str);
protected:
	CBrush m_brBkgnd; // Holds Brush Color for the Static Text
	COLORREF m_crBkColor; // Holds the Background Color for the Text
	COLORREF m_crTextColor; // Holds the Color for the Text
	CFont m_cfTextFont;

	DECLARE_MESSAGE_MAP()
public:
	afx_msg void OnPaint();
	afx_msg BOOL OnEraseBkgnd(CDC* pDC);
};

class UICONTROL_API CColorStaticTable : public CStatic
{
	DECLARE_DYNAMIC(CColorStaticTable)

public:
	typedef struct StaticTableItem
	{
		int m_nSize;
		int m_nMarginBefore;
		int m_nMarginAfter;
		int m_nAlign;
	};

	CColorStaticTable();
	virtual ~CColorStaticTable();

	BOOL CreateTable(int nRow, int nCol, StaticTableItem *pRowItems, StaticTableItem *pColItems, BOOL bAlterColor);
	BOOL SetText(int nRow, int nCol, int nValue);
	BOOL SetText(int nRow, int nCol, double dValue);
	BOOL SetText(int nRow, int nCol, CString strText);
	void SetTextFont(int nRow, int nCol, int nPoint, LPCTSTR lpszFaceName, BOOL bBold = FALSE, BOOL bItalic = FALSE);

	BOOL SetTextColor(int nRow, int nCol, COLORREF clrText);
	BOOL SetBkgColor(int nRow, int nCol, COLORREF clrBkg);
	CString GetText(int nRow, int nCol);

	int GetNumRows() { return m_nRows; }
	int GetNumCols() { return m_nCols; }

	void EmptyTable(void);

protected:
	DECLARE_MESSAGE_MAP()

	CColorStatic * m_pwndStatics[MAX_PATH];

	int m_nRows;
	int m_nCols;
public:
	afx_msg BOOL OnEraseBkgnd(CDC* pDC);
	afx_msg void OnPaint();
};